from drg_group.yinchuan_2023.Base import message,intersect,SS_VALID
from drg_group.yinchuan_2023.DRG import MDCN_DRG

def group(record):
  adrg_zd=["A18.113+N74.1*","C53.900","C54.100","D06.900","D06.900x002","D07.100","D25.000","D25.000x002","D25.100x001","D25.100x002","D25.200","D25.200x002","D25.900","D25.900x001","D25.901","D26.000","D26.100","D26.100x002","D26.900","D27.x00","D28.202","D28.205","D39.101","N70.904","N71.001","N71.901","N71.902","N73.003","N73.101","N73.600x006","N73.602","N73.604","N73.902","N75.000","N80.000","N80.001","N80.100","N80.100x001","N80.302","N80.601","N80.900","N81.101","N81.301","N81.400","N81.802","N83.201","N84.000","N84.001","N84.100","N85.000","N85.001","N85.002","N85.003","N85.101","N85.600","N85.801","N85.807","N85.813","N85.814","N87.001","N87.101","N87.901","N88.102","N88.803","N89.806","N90.404","N92.400","N93.801","N93.900","N93.901","N95.000","N95.800","N97.100x001","N97.900","N99.800x010","Q51.202","Q51.203","Q51.900","R93.800x006","R93.803","T19.300x001","T83.301","T83.302","T83.303","T83.305"]
  adrg_zd1=[]
  adrg_ss=["68.1601","68.2100x002","68.2101","68.2204","68.2206","68.2300","68.2300x005","68.2301","68.2302","68.2900x028","68.2900x035","68.2900x038","68.2900x048","68.2901","68.2902","68.2903","68.2904","68.2905","68.2906","68.2907","68.2909","68.2910","68.2912","68.2913","68.2914","68.2915","68.2916","68.2917","68.2918","69.7x00","97.7101","97.7102","98.1600x001","98.1600x002"]
  adrg_ss1=[]
  adrg_ss2=[]
  dept_list=[]
  if True and record.zdList[0] in adrg_zd and record.ssList and record.ssList[0] in adrg_ss and record.ssList and intersect(record.ssList,adrg_ss):
    message('符合NE1入组条件，匹配规则：主诊断匹配、主手术匹配、某一手术匹配')
    
    if MDCN_DRG.NE19_group(record):
      return 'NE19'

    return 'NE1'
  else:
    return ''

